home *** CD-ROM | disk | FTP | other *** search
- /**
- GRAB Graph Layout and Browser System
-
- Copyright (c) 1986, 1988 Regents of the University of California
- Copyright (c) 1989, Tera Computer Company
- **/
-
- /**
- move a node. The routines in gview.c do the interesting stuff.
- We just pack up some information about the node and send it off.
- **/
-
- #include "malloc.h"
- #include "digraph.h"
- #include "scrdep.h"
- #include "globals.h"
- #include "interf.h"
-
- static NODE *moveNode;
-
- void DoSetUpMove()
- /**
- Before moving the node, we delete the displayed edges so it doesn't
- look sloppy. Of course, *we* don't do that, the routines in gview.c
- do. But we need to tell it where the edges are, so...
-
- The edges in the *digraph* are never deleted, just the displayed edges.
- **/
- {
- char **prevNodes, **nextNodes;
- int numprev, numnext;
- int i;
- VNO from_vno, to_vno;
-
- IChangeStatusLine("Moving node ...", TRUE);
-
- moveNode = (NODE *) ICurNode();
-
- numprev = card(Ante_set(moveNode));
- numnext = card(Succ_set(moveNode));
- prevNodes = (char **) malloc(numprev * sizeof(char *));
- nextNodes = (char **) malloc(numnext * sizeof(char *));
-
- i = 0;
- each_element(Ante_set(moveNode), from_vno)
- loop
- prevNodes[i] = (char *) Node(digraph, from_vno);
- i++;
- endloop;
-
- i = 0;
- each_element(Succ_set(moveNode), to_vno)
- loop
- nextNodes[i] = (char *) Node(digraph, to_vno);
- i++;
- endloop;
-
- ISetupMove((char*) moveNode, prevNodes, nextNodes, numprev, numnext);
- }
-
- void DoMoveEnd()
- /**
- Redraw the node centered on the current position.
- Redraw the edges.
- **/
- {
- int curx, cury;
-
- IGetCurPos(&curx, &cury);
- X_position(moveNode) = SCRX_TO_ABSX(&screen, curx);
- Y_position(moveNode) = SCRY_TO_ABSY(&screen, cury);
-
- draw_node(digraph, moveNode, &screen, TRUE);
- draw_in_edges(digraph, moveNode, &screen, TRUE, TRUE);
- draw_out_edges(digraph, moveNode, &screen, TRUE);
-
- EndMove();
- }
-
- EndMove()
- {
- IChangeStatusLine("End moving node", FALSE);
- graphChanged = TRUE;
- ckpt_done = FALSE;
- }
-